<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>发布作品</title>
    <link href="${server}/css/bootstrap.css" rel="stylesheet"/>
    <link href="${server}/css/main.css" rel="stylesheet"/>
    <link href="${server}/css/public.css" rel="stylesheet">
    <link href="${server}/css/uploadWork.css" rel="stylesheet"/>
</head>
<body class="person_body_bg">
<#include "nav.ftl">
<div class="container">
    <div class="catalog row col-sm-12 col-md-11">
        <div class="my_catalog  col-md-8">
            <a href="${server}/personal" id="personal"><span class="glyphicon glyphicon-cog"></span>个人设置</a>
            <a href="${server}/uploadWork" class="active" id="uploadWork"><span class="glyphicon glyphicon-open"></span>发布作品</a>
            <a href="${server}/myWorks" id="myWorks"><span class="glyphicon  glyphicon-list"></span>我的作品</a>
            <a href="${server}/myComments" id="myComments"><span class="glyphicon glyphicon-comment"></span>我的评论</a>
            <a href="${server}/myCollections" id="myCollections"><span class="glyphicon glyphicon-star"></span>我的收藏</a>
            <a href="${server}/myRecommends" id="myRecommends"><span
                    class="glyphicon glyphicon-thumbs-up"></span>我的推荐</a>
        </div>
    </div>
    <div class="upload_work row col-sm-12  col-md-7">
        <div class="title">
            <label>发布作品</label>
        </div>
        <form action="#" id="upLoadWorkForm" method="post" enctype="multipart/form-data">
            <div class="content">
                <label>作品名称</label>
                <input type="text" class="form-control" name="name" id="name" placeholder="作品名称，字数在15字以内~">
                <label>部门分类</label>
                <select name="classes" id="classes" class="form-control">
                    <option value="动漫部">动漫部</option>
                    <option value="技术部">技术部</option>
                    <option value="网络部">网络部</option>
                    <option value="行政部">行政部</option>
                    <option value="项目部">项目部</option>
                </select>
                <label>作品图片（用于展示作品的图片）</label>

                <span class="btn btn-default">上传<input type="file" name="file" id="file"></span>
                <input type="hidden" name="workImg" id="workImg" id="workImg" value="">
                <div class="workShowImg">
                    <img src="" id="Img">
                    <div class="document">
                        * 该照片放在图片展示首页，来展示你的作品。<br/>
                        * 照片尺寸183px * 137px（不一定按照这个，仅做参考）。<br/>
                        * 上传大小：1M 以内。<br/>
                        * 仅支持任何任何<strong>图片</strong>格式的后缀。<br/>
                    </div>
                </div>

                <label>作品内容</label><br/>
            </div>
            <input type="hidden" name="info" id="info" value="">
            <textarea class="workContent" name="content">请输入</textarea>
            <button class="btn btn-info" id="btn">提交</button>
        </form>
    </div>
    <div class="userInfo col-md-offset-1 col-md-3">
        <div class="title">
            <label>个人信息</label>
        </div>
        <div class="info clear">
            <a href="#" class="userImg"><img src="${user.img}"></a>
            <a href="#" class="userName"><span>${user.username}</span></a>
            <div class="option clear">
                <a href="#">
                    <span class="num">0</span>
                    <span class="name">我的文章</span>
                </a>
                <span class="divi"></span>
                <a href="#">
                    <span class="num">0</span>
                    <span class="name">我的消息</span>
                </a>
                <span class="divi"></span>
                <a href="#">
                    <span class="num">0</span>
                    <span class="name">我的收藏</span>
                </a>
            </div>
            <div class="sign">
                <label>个性签名:</label>
            ${user.sign!"主人很懒，什么都没留下~"}
            </div>
            <div class="profession">
                <label>我的专业是：</label>
            <#if user.college??>
            ${user.college}&nbsp;${user.major}&nbsp;${user.classes}
            <#else >
                专业未填
            </#if>
            </div>
        </div>
    </div>
</div>

<div id="footer_bg">
    <div class="footer clear">
        <div class="f1">联系我们</div>
        <div class="f2">
            <ul>
                <li>微信公众号：abc912342642</li>
                <li>新浪微博：郑州轻院计算机学院创业中心</li>
                <li>Email:zzuli_cyzx@163.com</li>
                <li>地址：计算机楼108</li>
            </ul>
        </div>
        <div class="f3">
            <img src="${server}/img/About/weixin.jpg" alt="weixin"/>
            <p>创业中心微信</p>
        </div>
        <div><img src="${server}/img/About/weibo.jpg" alt="weibo"/>
            <p>创业中心微博</p>
        </div>
    </div>
</div>
</body>
<script src="${server}/js/jquery.min.js"></script>
<script src="${server}/js/bootstrap.min.js"></script>
<script src="${server}/js/main.js"></script>
<script src="${server}/js/personal.js"></script>
<script src="${server}/ckeditor/ckeditor.js"></script>
<script type="text/javascript">
    CKEDITOR.replace('content');

    $('#btn').click(function () {
        var info = CKEDITOR.instances.content.getData();
        $('#info').val(info);

        $.ajax({
            url: "${server}/uploadWork",
            method: "POST",
            data: $('#upLoadWorkForm').serialize(),
            success: function (data) {
                if (data == "发布成功") {
                    alert(data);
                    $('#name').val("");
                    $('#classes').val("");
                    $('#img').attr("src", "");
                    CKEDITOR.instances.content.setData("");
                }
                else alert(data);
            }
        })
        return false;
    })

</script>
</html>
